from typing import List


class Solution:
    def firstMissingPositive(self, nums: List[int]) -> int:
        d = set()
        for i in range(len(nums)):
            if nums[i] > 0:
                d.add(nums[i])
        for i in range(len(nums)):
            if i + 1 not in d:
                return i + 1
        return len(nums) + 1 if len(nums) > 0 else 1


print(Solution().firstMissingPositive([1,2,0]))
